def validate_id(user_id):
    if len(user_id) > 8:
        return False
    for char in user_id:
        if not (char.isalnum() or char == '_'):
            return False
    return True

def validate_email(email):
    if '@' not in email or '.' not in email:
        return False
    if email.find('@') > email.find('.'):
        return False
    return True

def validate_id_card(id_card):
    if len(id_card) != 18:
        return False
    if not id_card[:-1].isdigit():
        return False
    if not (id_card[-1].isdigit() or id_card[-1] == 'X'):
        return False
    return True

def validate_name(name):
    if len(name) > 4:
        return False
    for char in name:
        if not ('\u4e00' <= char <= '\u9fa5'):
            return False
    return True

# 获取用户输入
user_id = input("请输入 ID：")
email = input("请输入 EMAIL 地址：")
id_card = input("请输入身份证号：")
name = input("请输入姓名：")

# 验证输入
if validate_id(user_id) and validate_email(email) and validate_id_card(id_card) and validate_name(name):
    # 提取性别
    gender = "男" if int(id_card[-2]) % 2 != 0 else "女"

    # 输出用户信息
    print("用户信息：")
    print("ID:", user_id)
    print("EMAIL:", email)
    print("身份证号:", id_card)
    print("姓名:", name)
    print("性别:", gender)
else:
    print("输入信息有误，请检查！")
